package com.bentley.kotlindemo.db.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.bentley.kotlindemo.db.entity.Author
import com.bentley.kotlindemo.db.entity.Teacher
import kotlinx.coroutines.flow.Flow

/**
 * <pre>
 *  ┌────────────────────────────────────────────
 *  │ @author  Lee  @date 2021/3/26 10:23
 *  ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
 *  │ @desc
 *  └────────────────────────────────────────────
 * </pre>
 */
@Dao
interface TeacherDao {
    @Query("SELECT * FROM teacher ORDER BY name")
    fun getAllList(): Flow<List<Teacher>>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insertAll(plants: List<Teacher>)
}